﻿using UnityEngine;
using System.Collections;
using BehaviorSystem;
using SkillSystem;

public class SkillItemCloseNode : ActionNode
{
    SkillItemData itemData;
    AnimatorComponnent animatorComponnent;

    public SkillItemCloseNode(IBehaviorAgent agent,SkillItemData itemData) : base(agent)
    {
        this.itemData = itemData;
        animatorComponnent = agent.GetComponent<AnimatorComponnent>();

    }

    public override BTNodeState HandleAction()
    {
        animatorComponnent.SetBool(itemData.ActionName, false);
        CurState = BTNodeState.Success;
        return CurState;
    }

    public override void OnReseted()
    {
        if (!string.IsNullOrEmpty(itemData.ActionName))
        {
            animatorComponnent.SetBool(itemData.ActionName, false);
        }

    }
}
